版权声明:本文为博主原创文章,转载请注明出处:http://blog.jerkybible.com/2013/11/01/2013-11-01-CODE 101 Longest Valid Parentheses/
Given a string containing just the characters '('
and ')'
,
find the length of the longest valid (well-formed) parentheses substring.
For "(()"
,
the longest valid parentheses substring is "()"
, which
has length = 2.
Another example is ")()())"
,
where the longest valid parentheses substring is "()()"
,
which has length = 4.
|
|